// pages/teacher-make-activity/index.js
import Notify from '../../miniprogram_npm/@vant/weapp/notify/notify';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    choose_part: 2,
    option: [
      { text: '1.单选题', value: 0 },
      { text: '2.多选题', value: 1 },
      { text: '3.判断题', value: 2 },
    ],
    value: 0,
    // switch 开关
    checked: false,
    part_name: "",
  },
  onLoad(options) {
    this.setData({
      part_name: options.part_name
    })

    if (this.data.part_name == "问卷") {
      this.setData({
        choose_part: 1
      })
    } else if (this.data.part_name == "投票") {
      this.setData({
        choose_part: 2
      })
    } else {
      this.setData({
        choose_part: 3
      })
    }
    console.log(this.data.choose_part)
  },
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  onChange({ detail }) {
    // 需要手动对 checked 状态进行更新
    this.setData({ checked: detail });
  },
  save_Activity() {
    wx.navigateTo({
      url: '/pages/activity-detail/index',
      success: (result) => {
        wx.showToast({
          title: '保存成功',
          icon: 'success',
          duration: 1500
        })
      },
      fail: () => { },
      complete: () => { }
    });
  },
  start_Activity() {
    wx.navigateTo({
      url: '/pages/activity-detail/index',
      success: (result) => {
        wx.showToast({
          title: '活动已开启',
          icon: 'success',
          duration: 1500
        })
      },
      fail: () => { },
      complete: () => { }
    });
  }
})